package command;

import java.util.regex.Pattern;

/**
 * The util class of regular
 * @author Jeff Zhuo
 *
 */
public class RegularUtil {
	
	
	/**
	 * Check if string is unsigned int.
	 * @param str
	 * @return 
	 */
	public static boolean isUnsignedInt(String str) {
		Pattern pattern = Pattern.compile("[0-9]*");
		return pattern.matcher(str).matches();
	}
	
	/**
	 * Check if string is format of email.
	 * @param email
	 * @return
	 */
	public static boolean emailFormat(String email) 
    { 
        final String pattern1 = "^([a-zA-Z0-9]+[_|_|.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|_|.]?)*[a-zA-Z0-9]+.[a-zA-Z]{2,4}$"; 
        final Pattern pattern = Pattern.compile(pattern1); 
        return pattern.matcher(email).matches(); 
    }

}
